﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;

namespace SpEasyClasses
{
    /// <summary>
    /// Permission-levels for the Users
    /// </summary>
    public enum Permission
    {
        Guest = 0,
        Member = 1,
        Moderator = 2,
        Administrator = 3
    }

    /// <summary>
    /// A class for handling users and their related data
    /// </summary>
    public class User
    {
        /// <summary>
        /// Gets or Sets the name of the user
        /// </summary>
        public String Name { get; set; }
        /// <summary>
        /// Gets or Sets the users personal message
        /// </summary>
        public String Message { get; set; }
        /// <summary>
        /// Gets or Sets the users permission level
        /// </summary>
        public Permission Permission { get; set; }
        /// <summary>
        /// The users socket
        /// </summary>
        public Socket UserSocket { get; set; }

        #region Constructors
        /// <summary>
        /// Creates a new instance of the user class
        /// </summary>
        /// <param name="name">The users name</param>
        public User(String name) : this(name, "", Permission.Guest) { }
        /// <summary>
        /// Creates a new instance of the user class
        /// </summary>
        /// <param name="name">The users name</param>
        /// <param name="msg">The personal message of the user</param>
        public User(String name, String msg) : this(name, msg, Permission.Guest) { }
        /// <summary>
        /// Creates a new instance of the user class
        /// </summary>
        /// <param name="name">The users name</param>
        /// <param name="perm">The permission-level of the user</param>
        public User(String name, Permission perm) : this(name, "", perm) { }
        /// <summary>
        /// Creates a new instance of the user class
        /// </summary>
        /// <param name="name">The users name</param>
        /// <param name="msg">The personal message of the user</param>
        /// <param name="perm">The permission-level of the user</param>
        public User(String name, String msg, Permission perm) /* Default constructor */
        {
            this.Name = name;
            this.Message = msg;
            this.Permission = perm;
        }
        #endregion
    }
}
